<!--
 * @Author: WangSir 3036970150@qq.com
 * @Date: 2022-11-24 11:46:52
 * @LastEditors: WangSir 3036970150@qq.com
 * @LastEditTime: 2022-11-25 18:01:55
 * @FilePath: \vue_express\src\pages\layoutPage\aside\Aside.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class='Aside'>
    <el-menu
      style="width: 200px; min-height: calc(100vh - 50px)"
      :default-active="defaultPath"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      :router="true">
      <template v-for="menu in menuList">
        <el-menu-item v-if="!menu.subMenu" :key="menu.path" :index="menu.path">
          <i :class="menu.icon"></i>
          <span slot="title">{{ menu.title }}</span>
        </el-menu-item>
        <el-submenu v-else :key="menu.path + '_submenu'" :index="menu.path">
          <template slot="title">
            <i :class="menu.icon"></i>
            <span>{{ menu.title }}</span>
          </template>
          <el-menu-item v-for="subMenu in menu.subMenu" :key="subMenu.path" :index="subMenu.path">
            <i :class="subMenu.icon"></i>
            <span slot="title">{{ subMenu.title }}</span>
          </el-menu-item>
        </el-submenu>
      </template>
    </el-menu>
  </div>
</template>

<script>
export default {
 name: 'Aside',
 data(){
 return {
    defaultPath:"",
    menuList:[],
    
 }
 },
 computed:{},
 components: {},
 created(){
  this.getMenuList();
 },
 mounted(){},
 methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      getMenuList(){
        //1.拿角色类型
        let user = JSON.parse(sessionStorage.getItem('user'))
        this.user = user
          //1为管理员，有控制台、用户管理、分类管理、资源列表、待审资源模块
          this.defaultPath="/layoutPage/console"
          this.menuList=[
            {
              path:"/layoutPage/console",
              icon:"el-icon-menu",
              title:"控制台"
            },
            {
          path: "/layoutPage/routesManagePage",
          icon: "el-icon-s-custom",
          title: "医生管理",
          subMenu: [
          {
              path:"/layoutPage/doctorManagementPage",
              icon:"el-icon-s-custom",
              title:"医生管理"
            },
            {
              path: "/layoutPage/docotorCreatePage",
              icon: "el-icon-plus",
              title: "医生入职"
            }
          ]
        },
            
            {
              path:"/layoutPage/appointmentManagementPage",
              icon:"el-icon-pie-chart",
              title:"预约管理"
            },
            {
              path:"/layoutPage/serviceRecordsPage",
              icon:"el-icon-s-order",
              title:"服务记录"
            },
            {
              path:"/layoutPage/medicalRecordsPage",
              icon:"el-icon-copy-document",
              title:"诊疗记录"
            },
           
            {
              path:"/layoutPage/serviceDetailsPage",
              icon:"el-icon-files",
              title:"服务管理",
              subMenu: [
          {
            path:"/layoutPage/serviceDetailsPage",
              icon:"el-icon-files",
              title:"服务管理",
            },
            {
              path:"/layoutPage/serviceDetailsCreatePage",
              icon:"el-icon-files",
              title:"添加服务",
            }
          ]
            },
            {
              path:"/layoutPage/userManagermentPage",
              icon:"el-icon-user-solid",
              title:"用户管理"
            },
            // {
            //   path:"/layoutPage/medicationManagementPage",
            //   icon:"el-icon-s-check",
            //   title:"药品管理"
            // },
            
          ]
        
      }

 }
}
</script>
<style scoped>


</style>
